/*
 *  hihocoder.com
 *
 *  Category: Greed
 */

/*-------- Includes --------*/
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

/*-------- Defines --------*/


/*-------- Types --------*/


/*-------- Global Variables --------*/
int N;
int A[10002];
int maxa;

/*-------- Function Prototypes --------*/


/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    int nCase;

    cin >> nCase;

    while (nCase--) {
        memset(A, 0, sizeof(A));
        maxa = -1;

        cin >> N;

        int t;
        for (int i = 0; i < N; ++i) {
            cin >> t;
            ++A[t];

            if (t > maxa) maxa = t;
        }

        int l1 = 0; // length of sequence is one
        int l2 = 0; // length of sequence is less or equal to two
        int l3 = 0; // length of sequence of all

        bool isbreak = false;

        for (int i = 0; i <= maxa; ++i) {
            if (A[i] < l2) {
                cout << "NO" << endl;
                isbreak = true;
                break;
            } else if (A[i] < l3) {
                l3 = A[i];
                l2 = l1;
                l1 = 0;
            } else {
                l2 = l1;
                l1 = 0;

                int d = A[i] - l3;
                l1 += d;
                l2 += d;
                l3 += d;
            }
            cout << l1 << ' ' << l2 << ' ' << l3 << endl;
        }

        if (isbreak) continue;

        if (l2 > 0) cout << "NO"  << endl;
        else        cout << "YES" << endl;
    }

    return 0;
}

/*-------- Functions --------*/

